Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Return applied alpha for MixUp#1572

Merged
ternaus merged 3 commits intomainfrom
mix_coef_return
Mar 12, 2024
Merged

Return applied alpha for MixUp#1572
ternaus merged 3 commits intomainfrom
mix_coef_return

Conversation

@Dipet
Copy link
Contributor

@Dipet Dipet commented Mar 10, 2024

Example:

import albumentations as A
import numpy as np
from albumentations.core.types import ReferenceImage

reference_data = [ReferenceImage(image=np.empty([100, 100, 3], dtype=np.uint8)) for i in range(10)]
augmentation_cls = A.RandomRotate90
params = {}
mix_up = A.MixUp(p=1, reference_data=reference_data, read_fn=lambda x: x)

aug = A.Compose([augmentation_cls(**params), mix_up])

image = np.empty([100, 100, 3], dtype=np.uint8)
mask = np.empty([100, 100, 3], dtype=np.uint8)
global_label = ["A"]
data = aug(image=image, global_label=global_label, mask=mask)
print(data["mix_coef"]). # 0.9991580344142427

@ternaus ternaus marked this pull request as ready for review March 12, 2024 00:05
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Dipet - I've reviewed your changes and they look great!

General suggestions:

  • Consider simplifying the implementation to reduce complexity and improve maintainability.
  • Ensure robustness by adding safeguards or documentation for accessing the 'mix_coef' in the 'params' dictionary.
  • Review the necessity of the conditional check for 'mix_coef_return_name' to streamline the code.
  • Evaluate the impact of the new feature on the class's design and usage, aiming for a balance between flexibility and simplicity.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Docstrings: all looks good

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@ternaus ternaus merged commit 95fac64 into main Mar 12, 2024
@ternaus ternaus deleted the mix_coef_return branch March 12, 2024 00:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments